package com.feri.fc.config;

import io.netty.util.concurrent.DefaultThreadFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 指尖造梦，精益求精！
 *
 * @Author：Feri
 * @Date：2024/12/3 15:24
 * @Modified：
 */
@Configuration
public class ThreadPoolConfig {

    @Value("${pool.core}")
    private Integer core;

    @Bean
    public ThreadPoolExecutor createTpe(){
        return new ThreadPoolExecutor(core,20,5, TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(100),new DefaultThreadFactory(""),
                new ThreadPoolExecutor.AbortPolicy());

    }
}
